home *** CD-ROM | disk | FTP | other *** search
MacBinary | 1995-08-15 | 6.9 KB | [TEXT/CWIE] |
open in:
MacOS 8.1
|
Win98
|
DOS
view JSON data
|
view as text
This file was processed as: MacBinary
(archive/macBinary).
You can browse this item here: PsychometricFit.c
Confidence | Program | Detection | Match Type | Support
|
---|
66%
| dexvert
| Compact Compressed (Unix) (archive/compact)
| ext
| Supported |
10%
| dexvert
| MacBinary (archive/macBinary)
| fallback
| Supported |
1%
| dexvert
| Text File (text/txt)
| fallback
| Supported |
100%
| file
| MacBinary II, inited, Tue Aug 15 13:50:16 1995, modified Tue Aug 15 13:50:16 1995, creator 'CWIE', type ASCII, 6367 bytes "PsychometricFit.c" , at 0x195f 466 bytes resource
| default (weak)
| |
99%
| file
| data
| default
| |
74%
| TrID
| Macintosh plain text (MacBinary)
| default
| |
25%
| TrID
| MacBinary 2
| default (weak)
| |
100%
| siegfried
| fmt/1762 MacBinary (II)
| default
| |
100%
| lsar
| MacBinary
| default
|
|
id metadata |
---|
key | value |
---|
macFileType | [TEXT] |
macFileCreator | [CWIE] |
hex view+--------+-------------------------+-------------------------+--------+--------+
|00000000| 00 11 50 73 79 63 68 6f | 6d 65 74 72 69 63 46 69 |..Psycho|metricFi|
|00000010| 74 2e 63 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |t.c.....|........|
|00000020| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000030| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000040| 00 54 45 58 54 43 57 49 | 45 01 00 00 00 00 00 00 |.TEXTCWI|E.......|
|00000050| 00 00 00 00 00 18 df 00 | 00 01 d2 ac 56 8e d8 ac |........|....V...|
|00000060| 56 8e d8 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |V.......|........|
|00000070| 00 00 00 00 00 00 00 00 | 00 00 81 81 c4 6d 00 00 |........|.....m..|
|00000080| 2f 2a 20 0d 50 73 79 63 | 68 6f 6d 65 74 72 69 63 |/* .Psyc|hometric|
|00000090| 46 69 74 2e 63 0d 43 6f | 70 79 72 69 67 68 74 20 |Fit.c.Co|pyright |
|000000a0| 31 39 39 30 20 28 63 29 | 20 44 65 6e 69 73 20 47 |1990 (c)| Denis G|
|000000b0| 2e 20 50 65 6c 6c 69 0d | 41 20 67 65 6e 65 72 61 |. Pelli.|A genera|
|000000c0| 6c 2d 70 75 72 70 6f 73 | 65 20 66 75 6e 63 74 69 |l-purpos|e functi|
|000000d0| 6f 6e 20 74 68 61 74 20 | 64 6f 65 73 20 61 20 6d |on that |does a m|
|000000e0| 61 78 69 6d 75 6d 20 6c | 69 6b 65 6c 69 68 6f 6f |aximum l|ikelihoo|
|000000f0| 64 20 66 69 74 20 6f 66 | 20 61 6e 79 0d 70 73 79 |d fit of| any.psy|
|00000100| 63 68 6f 6d 65 74 72 69 | 63 20 66 75 6e 63 74 69 |chometri|c functi|
|00000110| 6f 6e 20 74 6f 20 70 73 | 79 63 68 6f 6d 65 74 72 |on to ps|ychometr|
|00000120| 69 63 20 64 61 74 61 2e | 20 54 68 65 20 72 65 74 |ic data.| The ret|
|00000130| 75 72 6e 65 64 20 76 61 | 6c 75 65 20 69 73 20 74 |urned va|lue is t|
|00000140| 68 65 20 6c 65 76 65 6c | 20 6f 66 0d 73 69 67 6e |he level| of.sign|
|00000150| 69 66 69 63 61 6e 63 65 | 20 61 74 20 77 68 69 63 |ificance| at whic|
|00000160| 68 20 74 68 65 20 66 69 | 74 20 63 61 6e 20 62 65 |h the fi|t can be|
|00000170| 20 72 65 6a 65 63 74 65 | 64 2e 20 54 68 65 20 64 | rejecte|d. The d|
|00000180| 65 67 72 65 65 73 4f 66 | 46 72 65 65 64 6f 6d 20 |egreesOf|Freedom |
|00000190| 6d 61 79 20 62 65 20 7a | 65 72 6f 2c 0d 69 6e 20 |may be z|ero,.in |
|000001a0| 77 68 69 63 68 20 63 61 | 73 65 20 6e 6f 20 70 61 |which ca|se no pa|
|000001b0| 72 61 6d 65 74 65 72 73 | 20 77 69 6c 6c 20 62 65 |rameters| will be|
|000001c0| 20 61 64 6a 75 73 74 65 | 64 2c 20 62 75 74 20 79 | adjuste|d, but y|
|000001d0| 6f 75 27 6c 6c 20 67 65 | 74 20 74 68 65 20 6c 6f |ou'll ge|t the lo|
|000001e0| 67 20 6c 69 6b 65 6c 69 | 68 6f 6f 64 0d 61 6e 64 |g likeli|hood.and|
|000001f0| 20 73 69 67 6e 69 66 69 | 63 61 6e 63 65 20 6f 66 | signifi|cance of|
|00000200| 20 74 68 65 20 73 75 70 | 70 6c 69 65 64 20 70 61 | the sup|plied pa|
|00000210| 72 61 6d 65 74 65 72 20 | 76 61 6c 75 65 73 2e 0d |rameter |values..|
|00000220| 0d 54 68 65 20 70 73 79 | 63 68 6f 6d 65 74 72 69 |.The psy|chometri|
|00000230| 63 20 66 75 6e 63 74 69 | 6f 6e 20 28 77 68 69 63 |c functi|on (whic|
|00000240| 68 20 79 6f 75 20 73 75 | 70 70 6c 79 20 61 73 20 |h you su|pply as |
|00000250| 61 6e 20 61 72 67 75 6d | 65 6e 74 29 20 74 61 6b |an argum|ent) tak|
|00000260| 65 73 20 74 77 6f 20 61 | 72 67 75 6d 65 6e 74 73 |es two a|rguments|
|00000270| 3a 0d 61 20 63 6f 6e 74 | 72 61 73 74 20 61 6e 64 |:.a cont|rast and|
|00000280| 20 61 20 70 6f 69 6e 74 | 65 72 20 74 6f 20 61 20 | a point|er to a |
|00000290| 70 61 72 61 6d 52 65 63 | 6f 72 64 2e 20 54 68 65 |paramRec|ord. The|
|000002a0| 20 66 75 6e 63 74 69 6f | 6e 20 57 65 69 62 75 6c | functio|n Weibul|
|000002b0| 6c 28 29 20 69 73 20 70 | 72 6f 76 69 64 65 64 20 |l() is p|rovided |
|000002c0| 69 6e 0d 57 65 69 62 75 | 6c 6c 2e 63 2e 20 4f 74 |in.Weibu|ll.c. Ot|
|000002d0| 68 65 72 73 20 6d 61 79 | 20 62 65 20 61 64 64 65 |hers may| be adde|
|000002e0| 64 20 61 73 20 64 65 73 | 69 72 65 64 2e 20 49 74 |d as des|ired. It|
|000002f0| 20 69 73 20 61 73 73 75 | 6d 65 64 20 74 68 61 74 | is assu|med that|
|00000300| 20 74 68 65 20 66 69 72 | 73 74 0d 70 61 72 61 6d | the fir|st.param|
|00000310| 65 74 65 72 20 69 73 20 | 74 68 65 20 6c 6f 67 20 |eter is |the log |
|00000320| 6f 66 20 74 68 72 65 73 | 68 6f 6c 64 2e 20 4e 6f |of thres|hold. No|
|00000330| 20 61 73 73 75 6d 70 74 | 69 6f 6e 73 20 61 72 65 | assumpt|ions are|
|00000340| 20 6d 61 64 65 20 61 62 | 6f 75 74 20 74 68 65 20 | made ab|out the |
|00000350| 6f 74 68 65 72 0d 70 61 | 72 61 6d 65 74 65 72 73 |other.pa|rameters|
|00000360| 2c 20 65 78 63 65 70 74 | 20 74 68 61 74 20 61 6e |, except| that an|
|00000370| 79 20 74 68 61 74 20 61 | 72 65 20 74 6f 20 62 65 |y that a|re to be|
|00000380| 20 69 74 65 72 61 74 69 | 76 65 6c 79 20 66 69 74 | iterati|vely fit|
|00000390| 20 61 72 65 20 61 73 73 | 75 6d 65 64 20 74 6f 20 | are ass|umed to |
|000003a0| 62 65 20 6f 66 0d 74 79 | 70 65 20 22 64 6f 75 62 |be of.ty|pe "doub|
|000003b0| 6c 65 22 2e 0d 0d 51 75 | 69 63 6b 33 2e 63 20 69 |le"...Qu|ick3.c i|
|000003c0| 73 20 61 20 73 74 61 6e | 64 2d 61 6c 6f 6e 65 20 |s a stan|d-alone |
|000003d0| 70 72 6f 67 72 61 6d 20 | 74 68 61 74 20 75 73 65 |program |that use|
|000003e0| 73 20 50 73 79 63 68 6f | 6d 65 74 72 69 63 46 69 |s Psycho|metricFi|
|000003f0| 74 28 29 20 74 6f 20 64 | 6f 20 74 68 65 20 72 65 |t() to d|o the re|
|00000400| 61 6c 20 77 6f 72 6b 2e | 0d 49 20 73 75 67 67 65 |al work.|.I sugge|
|00000410| 73 74 20 79 6f 75 20 72 | 65 61 64 20 74 68 65 20 |st you r|ead the |
|00000420| 69 6e 74 72 6f 64 75 63 | 74 6f 72 79 20 63 6f 6d |introduc|tory com|
|00000430| 6d 65 6e 74 73 20 61 74 | 20 74 68 65 20 62 65 67 |ments at| the beg|
|00000440| 69 6e 6e 69 6e 67 20 6f | 66 20 51 75 69 63 6b 33 |inning o|f Quick3|
|00000450| 2e 63 0d 0d 48 49 53 54 | 4f 52 59 3a 0d 34 2f 37 |.c..HIST|ORY:.4/7|
|00000460| 2f 39 30 09 09 64 67 70 | 20 77 72 6f 74 65 20 69 |/90..dgp| wrote i|
|00000470| 74 0d 31 30 2f 32 39 2f | 39 30 09 64 67 70 09 74 |t.10/29/|90.dgp.t|
|00000480| 69 64 69 65 64 20 75 70 | 20 74 68 65 20 63 6f 6d |idied up| the com|
|00000490| 6d 65 6e 74 73 0d 31 31 | 2f 31 37 2f 39 32 09 64 |ments.11|/17/92.d|
|000004a0| 67 70 20 22 0d 31 2f 32 | 35 2f 39 33 20 64 67 70 |gp ".1/2|5/93 dgp|
|000004b0| 20 72 65 6d 6f 76 65 64 | 20 6f 62 73 6f 6c 65 74 | removed| obsolet|
|000004c0| 65 20 73 75 70 70 6f 72 | 74 20 66 6f 72 20 54 48 |e suppor|t for TH|
|000004d0| 49 4e 4b 20 43 20 34 2e | 0d 39 2f 35 2f 39 34 20 |INK C 4.|.9/5/94 |
|000004e0| 64 67 70 20 72 65 6d 6f | 76 65 64 20 61 73 73 75 |dgp remo|ved assu|
|000004f0| 6d 70 74 69 6f 6e 20 69 | 6e 20 70 72 69 6e 74 66 |mption i|n printf|
|00000500| 27 73 20 74 68 61 74 20 | 69 6e 74 3d 3d 73 68 6f |'s that |int==sho|
|00000510| 72 74 2e 0d 0d 53 4f 55 | 52 43 45 53 3a 0d 51 75 |rt...SOU|RCES:.Qu|
|00000520| 69 63 6b 33 2e 68 0d 4c | 6f 67 4c 69 6b 65 6c 69 |ick3.h.L|ogLikeli|
|00000530| 68 6f 6f 64 2e 63 0d 4d | 6f 6e 6f 74 6f 6e 69 63 |hood.c.M|onotonic|
|00000540| 46 69 74 2e 63 0d 50 73 | 79 63 68 6f 6d 65 74 72 |Fit.c.Ps|ychometr|
|00000550| 69 63 46 69 74 2e 63 0d | 53 6f 72 74 41 6e 64 4d |icFit.c.|SortAndM|
|00000560| 65 72 67 65 43 6f 6e 74 | 72 61 73 74 73 2e 63 0d |ergeCont|rasts.c.|
|00000570| 57 65 69 62 75 6c 6c 2e | 63 0d 23 46 72 6f 6d 20 |Weibull.|c.#From |
|00000580| 44 65 6e 69 73 20 50 65 | 6c 6c 69 27 73 20 56 69 |Denis Pe|lli's Vi|
|00000590| 64 65 6f 54 6f 6f 6c 62 | 6f 78 3a 0d 56 69 64 65 |deoToolb|ox:.Vide|
|000005a0| 6f 54 6f 6f 6c 62 6f 78 | 2e 68 0d 42 69 6e 6f 6d |oToolbox|.h.Binom|
|000005b0| 69 61 6c 2e 63 0d 43 68 | 69 53 71 75 61 72 65 2e |ial.c.Ch|iSquare.|
|000005c0| 63 0d 4e 6f 72 6d 61 6c | 2e 63 0d 53 65 74 46 69 |c.Normal|.c.SetFi|
|000005d0| 6c 65 49 6e 66 6f 2e 63 | 09 09 23 20 55 73 65 64 |leInfo.c|..# Used|
|000005e0| 20 6f 6e 6c 79 20 6f 6e | 20 74 68 65 20 4d 61 63 | only on| the Mac|
|000005f0| 69 6e 74 6f 73 68 0d 23 | 46 72 6f 6d 20 4e 75 6d |intosh.#|From Num|
|00000600| 65 72 69 63 61 6c 20 52 | 65 63 69 70 65 73 20 69 |erical R|ecipes i|
|00000610| 6e 20 43 3a 0d 6e 72 2e | 68 0d 4e 52 55 54 49 4c |n C:.nr.|h.NRUTIL|
|00000620| 2e 68 0d 42 52 45 4e 54 | 2e 43 0d 46 31 44 49 4d |.h.BRENT|.C.F1DIM|
|00000630| 2e 43 0d 4c 49 4e 4d 49 | 4e 2e 43 0d 4d 4e 42 52 |.C.LINMI|N.C.MNBR|
|00000640| 41 4b 2e 43 0d 4e 52 55 | 54 49 4c 2e 43 0d 50 4f |AK.C.NRU|TIL.C.PO|
|00000650| 57 45 4c 4c 2e 43 0d 0d | 4c 49 4d 49 54 41 54 49 |WELL.C..|LIMITATI|
|00000660| 4f 4e 53 0d 0d 54 68 69 | 73 20 70 72 6f 67 72 61 |ONS..Thi|s progra|
|00000670| 6d 20 75 73 65 73 20 72 | 6f 75 74 69 6e 65 73 20 |m uses r|outines |
|00000680| 66 72 6f 6d 20 4e 75 6d | 65 72 69 63 61 6c 20 52 |from Num|erical R|
|00000690| 65 63 69 70 65 73 20 69 | 6e 20 43 2e 20 54 68 65 |ecipes i|n C. The|
|000006a0| 79 27 72 65 20 63 6f 70 | 79 72 69 67 68 74 65 64 |y're cop|yrighted|
|000006b0| 2c 20 0d 73 6f 20 49 20 | 63 61 6e 27 74 20 64 69 |, .so I |can't di|
|000006c0| 73 74 72 69 62 75 74 65 | 20 74 68 65 6d 2e 20 59 |stribute| them. Y|
|000006d0| 6f 75 20 63 61 6e 20 6f | 72 64 65 72 20 74 68 65 |ou can o|rder the|
|000006e0| 20 73 6f 66 74 77 61 72 | 65 3a 0d 09 4e 75 6d 65 | softwar|e:..Nume|
|000006f0| 72 69 63 61 6c 20 52 65 | 63 69 70 65 73 20 43 20 |rical Re|cipes C |
|00000700| 44 69 73 6b 65 74 74 65 | 20 66 6f 72 20 4d 61 63 |Diskette| for Mac|
|00000710| 69 6e 74 6f 73 68 20 24 | 32 39 2e 39 35 0d 61 6e |intosh $|29.95.an|
|00000720| 64 20 62 6f 6f 6b 3a 0d | 09 4e 75 6d 65 72 69 63 |d book:.|.Numeric|
|00000730| 61 6c 20 52 65 63 69 70 | 65 73 20 69 6e 20 43 3a |al Recip|es in C:|
|00000740| 20 54 68 65 20 41 72 74 | 20 6f 66 20 53 63 69 65 | The Art| of Scie|
|00000750| 6e 74 69 66 69 63 20 43 | 6f 6d 70 75 74 69 6e 67 |ntific C|omputing|
|00000760| 20 24 34 34 2e 35 30 0d | 66 72 6f 6d 3a 0d 09 43 | $44.50.|from:..C|
|00000770| 61 6d 62 72 69 64 67 65 | 20 55 6e 69 76 65 72 73 |ambridge| Univers|
|00000780| 69 74 79 20 50 72 65 73 | 73 0d 09 4f 72 64 65 72 |ity Pres|s..Order|
|00000790| 20 44 65 70 61 72 74 6d | 65 6e 74 0d 09 35 31 30 | Departm|ent..510|
|000007a0| 20 4e 6f 72 74 68 20 41 | 76 65 6e 75 65 0d 09 4e | North A|venue..N|
|000007b0| 65 77 20 52 6f 63 68 65 | 6c 6c 65 2c 20 4e 59 20 |ew Roche|lle, NY |
|000007c0| 31 30 38 30 31 0d 0d 4e | 6f 74 65 20 74 68 61 74 |10801..N|ote that|
|000007d0| 20 49 20 68 61 76 65 20 | 6d 61 64 65 20 73 65 76 | I have |made sev|
|000007e0| 65 72 61 6c 20 63 68 61 | 6e 67 65 73 20 74 6f 20 |eral cha|nges to |
|000007f0| 74 68 65 20 4e 75 6d 65 | 72 69 63 61 6c 20 52 65 |the Nume|rical Re|
|00000800| 63 69 70 65 73 20 69 6e | 20 43 20 72 6f 75 74 69 |cipes in| C routi|
|00000810| 6e 65 73 3a 20 0d 31 2e | 49 6e 20 65 76 65 72 79 |nes: .1.|In every|
|00000820| 20 66 69 6c 65 20 49 20 | 63 68 61 6e 67 65 64 20 | file I |changed |
|00000830| 22 66 6c 6f 61 74 22 20 | 74 6f 20 22 46 4c 4f 41 |"float" |to "FLOA|
|00000840| 54 22 2c 20 61 6e 64 20 | 23 69 6e 63 6c 75 64 65 |T", and |#include|
|00000850| 64 20 6e 72 2e 68 2e 20 | 49 20 69 6e 73 65 72 74 |d nr.h. |I insert|
|00000860| 65 64 20 74 68 65 20 0d | 73 74 61 74 65 6d 65 6e |ed the .|statemen|
|00000870| 74 20 22 74 79 70 65 64 | 65 66 20 64 6f 75 62 6c |t "typed|ef doubl|
|00000880| 65 20 46 4c 4f 41 54 3b | 22 20 69 6e 20 74 68 65 |e FLOAT;|" in the|
|00000890| 20 66 69 6c 65 20 6e 72 | 2e 68 2e 20 54 68 69 73 | file nr|.h. This|
|000008a0| 20 69 73 20 62 65 63 61 | 75 73 65 20 74 68 65 20 | is beca|use the |
|000008b0| 0d 4d 61 63 69 6e 74 6f | 73 68 20 63 6f 6d 70 75 |.Macinto|sh compu|
|000008c0| 74 65 73 20 64 6f 75 62 | 6c 65 73 20 6d 75 63 68 |tes doub|les much|
|000008d0| 20 66 61 73 74 65 72 20 | 74 68 61 6e 20 66 6c 6f | faster |than flo|
|000008e0| 61 74 73 2e 20 49 66 20 | 79 6f 75 27 64 20 72 61 |ats. If |you'd ra|
|000008f0| 74 68 65 72 20 72 75 6e | 0d 73 6c 6f 77 6c 79 20 |ther run|.slowly |
|00000900| 74 68 61 6e 20 6d 6f 64 | 69 66 79 20 79 6f 75 72 |than mod|ify your|
|00000910| 20 4e 75 6d 65 72 69 63 | 61 6c 20 52 65 63 69 70 | Numeric|al Recip|
|00000920| 65 73 20 69 6e 20 43 20 | 66 69 6c 65 73 2c 20 74 |es in C |files, t|
|00000930| 68 65 6e 20 79 6f 75 20 | 77 69 6c 6c 20 6e 65 65 |hen you |will nee|
|00000940| 64 20 74 6f 20 69 6e 73 | 65 72 74 20 0d 22 74 79 |d to ins|ert ."ty|
|00000950| 70 65 64 65 66 20 66 6c | 6f 61 74 20 46 4c 4f 41 |pedef fl|oat FLOA|
|00000960| 54 3b 22 0d 69 6e 20 43 | 61 6c 69 62 72 61 74 65 |T;".in C|alibrate|
|00000970| 4c 75 6d 69 6e 61 6e 63 | 65 2e 63 20 26 20 50 73 |Luminanc|e.c & Ps|
|00000980| 79 63 68 6f 6d 65 74 72 | 69 63 46 69 74 2e 63 20 |ychometr|icFit.c |
|00000990| 69 6e 20 6f 72 64 65 72 | 20 74 6f 20 63 6f 6d 70 |in order| to comp|
|000009a0| 69 6c 65 20 74 68 6f 73 | 65 20 66 69 6c 65 73 2e |ile thos|e files.|
|000009b0| 0d 54 68 65 20 72 65 73 | 74 20 6f 66 20 74 68 65 |.The res|t of the|
|000009c0| 20 56 69 64 65 6f 54 6f | 6f 6c 62 6f 78 20 64 6f | VideoTo|olbox do|
|000009d0| 65 73 6e 27 74 20 63 61 | 72 65 2e 0d 2a 2f 0d 23 |esn't ca|re..*/.#|
|000009e0| 69 6e 63 6c 75 64 65 20 | 22 56 69 64 65 6f 54 6f |include |"VideoTo|
|000009f0| 6f 6c 62 6f 78 2e 68 22 | 0d 23 69 6e 63 6c 75 64 |olbox.h"|.#includ|
|00000a00| 65 20 22 51 75 69 63 6b | 33 2e 68 22 0d 23 69 6e |e "Quick|3.h".#in|
|00000a10| 63 6c 75 64 65 20 22 6e | 72 2e 68 22 09 09 09 2f |clude "n|r.h".../|
|00000a20| 2a 20 70 72 6f 74 6f 74 | 79 70 65 73 20 6f 66 20 |* protot|ypes of |
|00000a30| 4e 75 6d 65 72 69 63 61 | 6c 20 52 65 63 69 70 65 |Numerica|l Recipe|
|00000a40| 73 20 61 6e 64 20 64 65 | 66 69 6e 69 74 69 6f 6e |s and de|finition|
|00000a50| 20 6f 66 20 46 4c 4f 41 | 54 20 2a 2f 0d 23 69 6e | of FLOA|T */.#in|
|00000a60| 63 6c 75 64 65 20 22 6e | 72 75 74 69 6c 2e 68 22 |clude "n|rutil.h"|
|00000a70| 0d 0d 23 64 65 66 69 6e | 65 20 54 4f 4c 45 52 41 |..#defin|e TOLERA|
|00000a80| 4e 43 45 20 30 2e 30 30 | 31 09 2f 2a 20 66 72 61 |NCE 0.00|1./* fra|
|00000a90| 63 74 69 6f 6e 61 6c 20 | 74 6f 6c 65 72 61 6e 63 |ctional |toleranc|
|00000aa0| 65 20 6f 66 20 6c 6f 67 | 20 6c 69 6b 65 6c 69 68 |e of log| likelih|
|00000ab0| 6f 6f 64 2e 20 4e 6f 74 | 20 63 72 69 74 69 63 61 |ood. Not| critica|
|00000ac0| 6c 2e 20 2a 2f 0d 0d 2f | 2a 0d 49 20 68 61 74 65 |l. */../|*.I hate|
|00000ad0| 20 67 6c 6f 62 61 6c 20 | 76 61 72 69 61 62 6c 65 | global |variable|
|00000ae0| 73 20 62 65 63 61 75 73 | 65 20 74 68 65 79 20 68 |s becaus|e they h|
|00000af0| 69 64 65 20 74 68 65 20 | 66 6c 6f 77 20 6f 66 20 |ide the |flow of |
|00000b00| 69 6e 66 6f 72 6d 61 74 | 69 6f 6e 2e 20 48 6f 77 |informat|ion. How|
|00000b10| 65 76 65 72 2c 0d 73 6f | 6d 65 20 73 6f 72 74 20 |ever,.so|me sort |
|00000b20| 6f 66 20 63 6c 75 64 67 | 65 20 69 73 20 6e 65 63 |of cludg|e is nec|
|00000b30| 65 73 73 61 72 79 20 74 | 6f 20 70 61 73 73 20 74 |essary t|o pass t|
|00000b40| 68 65 20 65 78 74 72 61 | 20 61 72 67 75 6d 65 6e |he extra| argumen|
|00000b50| 74 73 20 74 6f 20 45 72 | 72 6f 72 28 29 2c 20 62 |ts to Er|ror(), b|
|00000b60| 79 70 61 73 73 69 6e 67 | 0d 74 68 65 20 4e 75 6d |ypassing|.the Num|
|00000b70| 65 72 69 63 61 6c 20 52 | 65 63 69 70 65 73 20 72 |erical R|ecipes r|
|00000b80| 6f 75 74 69 6e 65 73 20 | 74 68 61 74 20 63 61 6c |outines |that cal|
|00000b90| 6c 20 69 74 2c 20 73 69 | 6e 63 65 20 74 68 65 79 |l it, si|nce they|
|00000ba0| 20 6f 6e 6c 79 20 70 61 | 73 73 20 74 68 65 20 0d | only pa|ss the .|
|00000bb0| 70 61 72 61 6d 65 74 65 | 72 73 20 74 68 65 79 20 |paramete|rs they |
|00000bc0| 6b 6e 6f 77 20 61 62 6f | 75 74 2e 20 54 68 65 73 |know abo|ut. Thes|
|00000bd0| 65 20 73 74 61 74 69 63 | 20 64 65 63 6c 61 72 61 |e static| declara|
|00000be0| 74 69 6f 6e 73 20 61 74 | 20 6c 65 61 73 74 20 72 |tions at| least r|
|00000bf0| 65 73 74 72 69 63 74 20 | 74 68 65 20 73 63 6f 70 |estrict |the scop|
|00000c00| 65 20 6f 66 0d 74 68 65 | 73 65 20 22 67 6c 6f 62 |e of.the|se "glob|
|00000c10| 61 6c 73 22 20 74 6f 20 | 74 68 69 73 20 66 69 6c |als" to |this fil|
|00000c20| 65 2e 0d 2a 2f 0d 73 74 | 61 74 69 63 20 46 4c 4f |e..*/.st|atic FLO|
|00000c30| 41 54 20 45 72 72 6f 72 | 28 46 4c 4f 41 54 20 2a |AT Error|(FLOAT *|
|00000c40| 70 29 3b 0d 73 74 61 74 | 69 63 20 64 61 74 61 52 |p);.stat|ic dataR|
|00000c50| 65 63 6f 72 64 20 2a 6d | 79 44 61 74 61 50 74 72 |ecord *m|yDataPtr|
|00000c60| 3b 09 09 09 09 2f 2a 20 | 66 6f 72 20 45 72 72 6f |;..../* |for Erro|
|00000c70| 72 28 29 20 2a 2f 0d 73 | 74 61 74 69 63 20 50 73 |r() */.s|tatic Ps|
|00000c80| 79 63 68 6f 6d 65 74 72 | 69 63 46 75 6e 63 74 69 |ychometr|icFuncti|
|00000c90| 6f 6e 50 74 72 20 4d 79 | 50 73 79 63 68 46 75 6e |onPtr My|PsychFun|
|00000ca0| 3b 09 2f 2a 20 66 6f 72 | 20 45 72 72 6f 72 28 29 |;./* for| Error()|
|00000cb0| 20 2a 2f 0d 73 74 61 74 | 69 63 20 70 61 72 61 6d | */.stat|ic param|
|00000cc0| 52 65 63 6f 72 64 20 6d | 79 50 61 72 61 6d 73 3b |Record m|yParams;|
|00000cd0| 09 09 09 09 2f 2a 20 66 | 6f 72 20 45 72 72 6f 72 |..../* f|or Error|
|00000ce0| 28 29 20 2a 2f 0d 73 74 | 61 74 69 63 20 69 6e 74 |() */.st|atic int|
|00000cf0| 20 6d 79 44 65 67 72 65 | 65 73 4f 66 46 72 65 65 | myDegre|esOfFree|
|00000d00| 64 6f 6d 3b 09 09 09 09 | 2f 2a 20 66 6f 72 20 45 |dom;....|/* for E|
|00000d10| 72 72 6f 72 28 29 20 2a | 2f 0d 73 74 61 74 69 63 |rror() *|/.static|
|00000d20| 20 69 6e 74 20 69 74 65 | 72 3b 09 09 09 09 09 09 | int ite|r;......|
|00000d30| 09 2f 2a 20 66 6f 72 20 | 45 72 72 6f 72 28 29 20 |./* for |Error() |
|00000d40| 2a 2f 0d 0d 64 6f 75 62 | 6c 65 20 50 73 79 63 68 |*/..doub|le Psych|
|00000d50| 6f 6d 65 74 72 69 63 46 | 69 74 28 70 61 72 61 6d |ometricF|it(param|
|00000d60| 52 65 63 6f 72 64 20 2a | 70 61 72 61 6d 50 74 72 |Record *|paramPtr|
|00000d70| 2c 50 73 79 63 68 6f 6d | 65 74 72 69 63 46 75 6e |,Psychom|etricFun|
|00000d80| 63 74 69 6f 6e 50 74 72 | 20 50 73 79 63 68 46 75 |ctionPtr| PsychFu|
|00000d90| 6e 0d 09 2c 64 61 74 61 | 52 65 63 6f 72 64 20 2a |n..,data|Record *|
|00000da0| 64 61 74 61 50 74 72 2c | 64 6f 75 62 6c 65 20 2a |dataPtr,|double *|
|00000db0| 6c 6f 67 4c 69 6b 65 6c | 69 68 6f 6f 64 50 74 72 |logLikel|ihoodPtr|
|00000dc0| 2c 69 6e 74 20 64 65 67 | 72 65 65 73 4f 66 46 72 |,int deg|reesOfFr|
|00000dd0| 65 65 64 6f 6d 0d 09 2c | 64 6f 75 62 6c 65 20 2a |eedom..,|double *|
|00000de0| 63 68 69 53 71 75 61 72 | 65 50 74 72 2c 69 6e 74 |chiSquar|ePtr,int|
|00000df0| 20 2a 63 68 69 53 71 75 | 61 72 65 44 46 50 74 72 | *chiSqu|areDFPtr|
|00000e00| 29 0d 7b 0d 09 69 6e 74 | 20 69 2c 6a 3b 0d 09 46 |).{..int| i,j;..F|
|00000e10| 4c 4f 41 54 20 2a 70 2c | 2a 2a 64 69 72 65 63 74 |LOAT *p,|**direct|
|00000e20| 69 6f 6e 2c 66 74 6f 6c | 2c 66 72 65 74 3b 0d 09 |ion,ftol|,fret;..|
|00000e30| 64 61 74 61 52 65 63 6f | 72 64 20 6d 6f 6e 6f 74 |dataReco|rd monot|
|00000e40| 6f 6e 69 63 44 61 74 61 | 3b 0d 09 64 6f 75 62 6c |onicData|;..doubl|
|00000e50| 65 20 6d 6f 6e 6f 74 6f | 6e 69 63 4c 4c 3b 0d 09 |e monoto|nicLL;..|
|00000e60| 69 6e 74 20 6d 6f 6e 6f | 74 6f 6e 69 63 44 46 3b |int mono|tonicDF;|
|00000e70| 0d 09 64 6f 75 62 6c 65 | 20 50 3b 0d 09 0d 09 6d |..double| P;....m|
|00000e80| 79 44 61 74 61 50 74 72 | 3d 64 61 74 61 50 74 72 |yDataPtr|=dataPtr|
|00000e90| 3b 09 09 2f 2a 20 63 6f | 70 79 20 74 68 65 73 65 |;../* co|py these|
|00000ea0| 20 66 6f 72 20 75 73 65 | 20 62 79 20 45 72 72 6f | for use| by Erro|
|00000eb0| 72 28 29 20 2a 2f 0d 09 | 4d 79 50 73 79 63 68 46 |r() */..|MyPsychF|
|00000ec0| 75 6e 3d 50 73 79 63 68 | 46 75 6e 3b 0d 09 6d 79 |un=Psych|Fun;..my|
|00000ed0| 50 61 72 61 6d 73 3d 2a | 70 61 72 61 6d 50 74 72 |Params=*|paramPtr|
|00000ee0| 3b 0d 09 6d 79 44 65 67 | 72 65 65 73 4f 66 46 72 |;..myDeg|reesOfFr|
|00000ef0| 65 65 64 6f 6d 3d 64 65 | 67 72 65 65 73 4f 66 46 |eedom=de|greesOfF|
|00000f00| 72 65 65 64 6f 6d 3b 0d | 09 0d 09 70 3d 76 65 63 |reedom;.|...p=vec|
|00000f10| 74 6f 72 28 31 2c 64 65 | 67 72 65 65 73 4f 66 46 |tor(1,de|greesOfF|
|00000f20| 72 65 65 64 6f 6d 29 3b | 0d 09 64 69 72 65 63 74 |reedom);|..direct|
|00000f30| 69 6f 6e 3d 6d 61 74 72 | 69 78 28 31 2c 64 65 67 |ion=matr|ix(1,deg|
|00000f40| 72 65 65 73 4f 66 46 72 | 65 65 64 6f 6d 2c 31 2c |reesOfFr|eedom,1,|
|00000f50| 64 65 67 72 65 65 73 4f | 66 46 72 65 65 64 6f 6d |degreesO|fFreedom|
|00000f60| 29 3b 09 2f 2a 20 69 6e | 69 74 69 61 6c 20 64 69 |);./* in|itial di|
|00000f70| 72 65 63 74 69 6f 6e 73 | 20 2a 2f 0d 09 69 66 28 |rections| */..if(|
|00000f80| 70 3d 3d 4e 55 4c 4c 20 | 7c 7c 20 64 69 72 65 63 |p==NULL ||| direc|
|00000f90| 74 69 6f 6e 20 3d 3d 20 | 4e 55 4c 4c 29 0d 09 09 |tion == |NULL)...|
|00000fa0| 50 72 69 6e 74 66 45 78 | 69 74 28 22 50 73 79 63 |PrintfEx|it("Psyc|
|00000fb0| 68 6f 6d 65 74 72 69 63 | 46 69 74 3a 20 6e 6f 74 |hometric|Fit: not|
|00000fc0| 20 65 6e 6f 75 67 68 20 | 72 6f 6f 6d 20 66 6f 72 | enough |room for|
|00000fd0| 20 61 72 72 61 79 73 2e | 5c 30 30 37 5c 6e 22 29 | arrays.|\007\n")|
|00000fe0| 3b 0d 09 66 6f 72 28 69 | 3d 31 3b 69 3c 3d 64 65 |;..for(i|=1;i<=de|
|00000ff0| 67 72 65 65 73 4f 66 46 | 72 65 65 64 6f 6d 3b 69 |greesOfF|reedom;i|
|00001000| 2b 2b 29 20 70 5b 69 5d | 3d 28 28 64 6f 75 62 6c |++) p[i]|=((doubl|
|00001010| 65 20 2a 29 70 61 72 61 | 6d 50 74 72 29 5b 69 2d |e *)para|mPtr)[i-|
|00001020| 31 5d 3b 0d 09 66 6f 72 | 28 69 3d 31 3b 69 3c 3d |1];..for|(i=1;i<=|
|00001030| 64 65 67 72 65 65 73 4f | 66 46 72 65 65 64 6f 6d |degreesO|fFreedom|
|00001040| 3b 69 2b 2b 29 66 6f 72 | 28 6a 3d 31 3b 6a 3c 3d |;i++)for|(j=1;j<=|
|00001050| 64 65 67 72 65 65 73 4f | 66 46 72 65 65 64 6f 6d |degreesO|fFreedom|
|00001060| 3b 6a 2b 2b 29 64 69 72 | 65 63 74 69 6f 6e 5b 69 |;j++)dir|ection[i|
|00001070| 5d 5b 6a 5d 3d 30 2e 30 | 3b 0d 09 66 6f 72 28 69 |][j]=0.0|;..for(i|
|00001080| 3d 31 3b 69 3c 3d 64 65 | 67 72 65 65 73 4f 66 46 |=1;i<=de|greesOfF|
|00001090| 72 65 65 64 6f 6d 3b 69 | 2b 2b 29 64 69 72 65 63 |reedom;i|++)direc|
|000010a0| 74 69 6f 6e 5b 69 5d 5b | 69 5d 3d 30 2e 30 33 3b |tion[i][|i]=0.03;|
|000010b0| 09 2f 2a 20 69 6e 69 74 | 69 61 6c 20 73 74 65 70 |./* init|ial step|
|000010c0| 20 73 69 7a 65 20 2a 2f | 0d 09 66 74 6f 6c 3d 54 | size */|..ftol=T|
|000010d0| 4f 4c 45 52 41 4e 43 45 | 3b 09 2f 2a 20 66 72 61 |OLERANCE|;./* fra|
|000010e0| 63 74 69 6f 6e 61 6c 20 | 74 6f 6c 65 72 61 6e 63 |ctional |toleranc|
|000010f0| 65 20 6f 6e 20 45 72 72 | 6f 72 20 76 61 6c 75 65 |e on Err|or value|
|00001100| 20 77 68 65 6e 20 64 6f | 6e 65 20 2a 2f 0d 09 69 | when do|ne */..i|
|00001110| 74 65 72 3d 30 3b 0d 09 | 0d 09 2f 2a 20 64 6f 20 |ter=0;..|../* do |
|00001120| 69 74 2e 20 54 68 65 20 | 70 73 79 63 68 6f 6d 65 |it. The |psychome|
|00001130| 74 72 69 63 20 66 75 6e | 63 74 69 6f 6e 20 69 73 |tric fun|ction is|
|00001140| 20 70 61 73 73 65 64 20 | 74 6f 20 45 72 72 6f 72 | passed |to Error|
|00001150| 20 62 79 20 74 68 65 20 | 67 6c 6f 62 61 6c 20 4d | by the |global M|
|00001160| 79 50 73 79 63 68 46 75 | 6e 20 2a 2f 0d 09 69 66 |yPsychFu|n */..if|
|00001170| 28 64 65 67 72 65 65 73 | 4f 66 46 72 65 65 64 6f |(degrees|OfFreedo|
|00001180| 6d 3d 3d 30 29 66 72 65 | 74 3d 45 72 72 6f 72 28 |m==0)fre|t=Error(|
|00001190| 70 29 3b 0d 09 65 6c 73 | 65 20 70 6f 77 65 6c 6c |p);..els|e powell|
|000011a0| 28 70 2c 64 69 72 65 63 | 74 69 6f 6e 2c 64 65 67 |(p,direc|tion,deg|
|000011b0| 72 65 65 73 4f 66 46 72 | 65 65 64 6f 6d 2c 66 74 |reesOfFr|eedom,ft|
|000011c0| 6f 6c 2c 26 69 74 65 72 | 2c 26 66 72 65 74 2c 26 |ol,&iter|,&fret,&|
|000011d0| 45 72 72 6f 72 29 3b 0d | 0d 09 66 6f 72 28 69 3d |Error);.|..for(i=|
|000011e0| 31 3b 69 3c 3d 64 65 67 | 72 65 65 73 4f 66 46 72 |1;i<=deg|reesOfFr|
|000011f0| 65 65 64 6f 6d 3b 69 2b | 2b 29 20 28 28 64 6f 75 |eedom;i+|+) ((dou|
|00001200| 62 6c 65 20 2a 29 70 61 | 72 61 6d 50 74 72 29 5b |ble *)pa|ramPtr)[|
|00001210| 69 2d 31 5d 3d 70 5b 69 | 5d 3b 0d 09 66 72 65 65 |i-1]=p[i|];..free|
|00001220| 5f 6d 61 74 72 69 78 28 | 64 69 72 65 63 74 69 6f |_matrix(|directio|
|00001230| 6e 2c 31 2c 64 65 67 72 | 65 65 73 4f 66 46 72 65 |n,1,degr|eesOfFre|
|00001240| 65 64 6f 6d 2c 31 2c 64 | 65 67 72 65 65 73 4f 66 |edom,1,d|egreesOf|
|00001250| 46 72 65 65 64 6f 6d 29 | 3b 0d 09 66 72 65 65 5f |Freedom)|;..free_|
|00001260| 76 65 63 74 6f 72 28 70 | 2c 31 2c 64 65 67 72 65 |vector(p|,1,degre|
|00001270| 65 73 4f 66 46 72 65 65 | 64 6f 6d 29 3b 0d 0d 09 |esOfFree|dom);...|
|00001280| 2a 6c 6f 67 4c 69 6b 65 | 6c 69 68 6f 6f 64 50 74 |*logLike|lihoodPt|
|00001290| 72 3d 2d 66 72 65 74 3b | 0d 09 0d 09 2f 2a 20 4e |r=-fret;|..../* N|
|000012a0| 6f 77 20 63 6f 6d 70 75 | 74 65 20 74 68 65 20 64 |ow compu|te the d|
|000012b0| 65 67 72 65 65 20 6f 66 | 20 73 69 67 6e 69 66 69 |egree of| signifi|
|000012c0| 63 61 6e 63 65 20 61 74 | 20 77 68 69 63 68 20 74 |cance at| which t|
|000012d0| 68 65 20 66 69 74 20 63 | 61 6e 20 62 65 20 72 65 |he fit c|an be re|
|000012e0| 6a 65 63 74 65 64 20 2a | 2f 0d 09 6d 6f 6e 6f 74 |jected *|/..monot|
|000012f0| 6f 6e 69 63 44 61 74 61 | 3d 20 2a 64 61 74 61 50 |onicData|= *dataP|
|00001300| 74 72 3b 0d 09 4d 6f 6e | 6f 74 6f 6e 69 63 46 69 |tr;..Mon|otonicFi|
|00001310| 74 28 26 6d 6f 6e 6f 74 | 6f 6e 69 63 44 61 74 61 |t(&monot|onicData|
|00001320| 2c 26 6d 6f 6e 6f 74 6f | 6e 69 63 4c 4c 2c 26 6d |,&monoto|nicLL,&m|
|00001330| 6f 6e 6f 74 6f 6e 69 63 | 44 46 29 3b 09 2f 2a 20 |onotonic|DF);./* |
|00001340| 6f 76 65 72 77 72 69 74 | 65 73 20 64 61 74 61 20 |overwrit|es data |
|00001350| 77 69 74 68 20 66 69 74 | 20 2a 2f 0d 09 2a 63 68 |with fit| */..*ch|
|00001360| 69 53 71 75 61 72 65 50 | 74 72 3d 20 2d 32 2e 30 |iSquareP|tr= -2.0|
|00001370| 2a 28 2a 6c 6f 67 4c 69 | 6b 65 6c 69 68 6f 6f 64 |*(*logLi|kelihood|
|00001380| 50 74 72 2d 6d 6f 6e 6f | 74 6f 6e 69 63 4c 4c 29 |Ptr-mono|tonicLL)|
|00001390| 3b 09 2f 2a 20 2d 32 20 | 6c 6f 67 20 6c 69 6b 65 |;./* -2 |log like|
|000013a0| 6c 69 68 6f 6f 64 20 72 | 61 74 69 6f 20 6f 66 20 |lihood r|atio of |
|000013b0| 68 79 70 6f 74 68 65 73 | 65 73 20 2a 2f 0d 09 2a |hypothes|es */..*|
|000013c0| 63 68 69 53 71 75 61 72 | 65 44 46 50 74 72 3d 6d |chiSquar|eDFPtr=m|
|000013d0| 6f 6e 6f 74 6f 6e 69 63 | 44 46 2d 64 65 67 72 65 |onotonic|DF-degre|
|000013e0| 65 73 4f 66 46 72 65 65 | 64 6f 6d 3b 09 09 09 2f |esOfFree|dom;.../|
|000013f0| 2a 20 64 69 66 66 65 72 | 65 6e 63 65 20 69 6e 20 |* differ|ence in |
|00001400| 64 65 67 72 65 65 73 20 | 6f 66 20 66 72 65 65 64 |degrees |of freed|
|00001410| 6f 6d 20 2a 2f 0d 09 50 | 3d 50 43 68 69 53 71 75 |om */..P|=PChiSqu|
|00001420| 61 72 65 28 2a 63 68 69 | 53 71 75 61 72 65 50 74 |are(*chi|SquarePt|
|00001430| 72 2c 2a 63 68 69 53 71 | 75 61 72 65 44 46 50 74 |r,*chiSq|uareDFPt|
|00001440| 72 29 3b 09 09 09 2f 2a | 20 73 69 67 6e 69 66 69 |r);.../*| signifi|
|00001450| 63 61 6e 63 65 20 2a 2f | 0d 09 72 65 74 75 72 6e |cance */|..return|
|00001460| 20 50 3b 0d 7d 0d 0d 2f | 2a 20 54 68 65 72 65 20 | P;.}../|* There |
|00001470| 69 73 20 61 20 73 75 62 | 74 6c 65 74 79 20 68 65 |is a sub|tlety he|
|00001480| 72 65 2e 20 49 20 74 68 | 6f 75 67 68 74 20 74 68 |re. I th|ought th|
|00001490| 61 74 20 49 20 63 6f 75 | 6c 64 20 75 73 65 20 50 |at I cou|ld use P|
|000014a0| 6f 77 65 6c 6c 20 77 69 | 74 68 20 74 68 65 20 77 |owell wi|th the w|
|000014b0| 68 6f 6c 65 0d 70 61 72 | 61 6d 52 65 63 6f 72 64 |hole.par|amRecord|
|000014c0| 2c 20 79 65 74 20 61 73 | 6b 20 50 6f 77 65 6c 6c |, yet as|k Powell|
|000014d0| 20 74 6f 20 6f 6e 6c 79 | 20 74 77 69 64 64 6c 65 | to only| twiddle|
|000014e0| 20 74 68 65 20 66 69 72 | 73 74 20 66 65 77 20 70 | the fir|st few p|
|000014f0| 61 72 61 6d 65 74 65 72 | 73 2c 20 66 69 67 75 72 |arameter|s, figur|
|00001500| 69 6e 67 20 74 68 61 74 | 0d 65 76 65 6e 20 77 68 |ing that|.even wh|
|00001510| 65 6e 20 49 20 77 61 73 | 20 61 73 6b 69 6e 67 20 |en I was| asking |
|00001520| 50 6f 77 65 6c 6c 20 74 | 6f 20 66 69 74 20 6f 6e |Powell t|o fit on|
|00001530| 6c 79 20 74 68 65 20 66 | 69 72 73 74 20 66 65 77 |ly the f|irst few|
|00001540| 20 70 61 72 61 6d 65 74 | 65 72 73 20 74 68 65 20 | paramet|ers the |
|00001550| 6f 74 68 65 72 0d 70 61 | 72 61 6d 65 74 65 72 73 |other.pa|rameters|
|00001560| 20 77 6f 75 6c 64 20 73 | 74 69 6c 6c 20 62 65 20 | would s|till be |
|00001570| 74 68 65 72 65 20 69 6e | 20 74 68 65 20 61 72 72 |there in| the arr|
|00001580| 61 79 20 77 68 65 6e 20 | 74 68 65 20 70 6f 69 6e |ay when |the poin|
|00001590| 74 65 72 20 74 6f 20 74 | 68 65 20 61 72 72 61 79 |ter to t|he array|
|000015a0| 20 77 61 73 0d 70 61 73 | 73 65 64 20 74 6f 20 45 | was.pas|sed to E|
|000015b0| 72 72 6f 72 28 29 2e 20 | 41 6c 61 73 2c 20 50 6f |rror(). |Alas, Po|
|000015c0| 77 65 6c 6c 28 29 20 61 | 6e 64 20 69 74 73 20 73 |well() a|nd its s|
|000015d0| 75 62 72 6f 75 74 69 6e | 65 73 20 6d 61 6b 65 20 |ubroutin|es make |
|000015e0| 43 4f 50 49 45 53 20 6f | 66 20 74 68 65 20 61 72 |COPIES o|f the ar|
|000015f0| 72 61 79 2c 0d 61 6e 64 | 20 6e 61 74 75 72 61 6c |ray,.and| natural|
|00001600| 6c 79 20 66 61 69 6c 20 | 74 6f 20 63 6f 70 79 20 |ly fail |to copy |
|00001610| 74 68 65 20 6e 6f 6e 2d | 74 77 69 64 64 6c 65 64 |the non-|twiddled|
|00001620| 20 70 61 72 61 6d 65 74 | 65 72 73 2c 20 73 69 6e | paramet|ers, sin|
|00001630| 63 65 20 74 68 65 79 20 | 64 6f 6e 27 74 20 6b 6e |ce they |don't kn|
|00001640| 6f 77 20 61 62 6f 75 74 | 0d 74 68 65 6d 2e 20 54 |ow about|.them. T|
|00001650| 68 65 20 73 6f 6c 75 74 | 69 6f 6e 20 69 73 20 66 |he solut|ion is f|
|00001660| 6f 72 20 45 72 72 6f 72 | 28 29 20 74 6f 20 68 61 |or Error|() to ha|
|00001670| 76 65 20 69 74 73 20 6f | 77 6e 20 63 6f 6d 70 6c |ve its o|wn compl|
|00001680| 65 74 65 20 63 6f 70 79 | 20 6f 66 20 74 68 65 20 |ete copy| of the |
|00001690| 70 61 72 61 6d 52 65 63 | 6f 72 64 2e 0d 45 61 63 |paramRec|ord..Eac|
|000016a0| 68 20 74 69 6d 65 20 45 | 72 72 6f 72 28 29 20 69 |h time E|rror() i|
|000016b0| 73 20 63 61 6c 6c 65 64 | 20 69 74 20 75 70 64 61 |s called| it upda|
|000016c0| 74 65 73 20 74 68 65 20 | 74 77 69 64 64 6c 65 64 |tes the |twiddled|
|000016d0| 20 70 61 72 61 6d 65 74 | 65 72 73 20 62 65 66 6f | paramet|ers befo|
|000016e0| 72 65 20 63 61 6c 6c 69 | 6e 67 0d 4c 6f 67 4c 69 |re calli|ng.LogLi|
|000016f0| 6b 65 6c 69 68 6f 6f 64 | 28 29 2c 20 77 68 69 63 |kelihood|(), whic|
|00001700| 68 20 63 61 6c 6c 73 20 | 74 68 65 20 70 73 79 63 |h calls |the psyc|
|00001710| 68 6f 6d 65 74 72 69 63 | 20 66 75 6e 63 74 69 6f |hometric| functio|
|00001720| 6e 20 28 2a 4d 79 50 73 | 79 63 68 46 75 6e 29 28 |n (*MyPs|ychFun)(|
|00001730| 29 2e 0d 2a 2f 0d 0d 46 | 4c 4f 41 54 20 45 72 72 |)..*/..F|LOAT Err|
|00001740| 6f 72 28 46 4c 4f 41 54 | 20 2a 70 29 0d 7b 0d 09 |or(FLOAT| *p).{..|
|00001750| 46 4c 4f 41 54 20 65 72 | 72 6f 72 3b 0d 09 69 6e |FLOAT er|ror;..in|
|00001760| 74 20 69 3b 0d 09 73 74 | 61 74 69 63 20 69 6e 74 |t i;..st|atic int|
|00001770| 20 6c 61 73 74 49 74 65 | 72 3d 30 3b 0d 09 0d 09 | lastIte|r=0;....|
|00001780| 66 6f 72 28 69 3d 31 3b | 69 3c 3d 6d 79 44 65 67 |for(i=1;|i<=myDeg|
|00001790| 72 65 65 73 4f 66 46 72 | 65 65 64 6f 6d 3b 69 2b |reesOfFr|eedom;i+|
|000017a0| 2b 29 20 28 28 64 6f 75 | 62 6c 65 20 2a 29 26 6d |+) ((dou|ble *)&m|
|000017b0| 79 50 61 72 61 6d 73 29 | 5b 69 2d 31 5d 3d 70 5b |yParams)|[i-1]=p[|
|000017c0| 69 5d 3b 0d 09 0d 09 65 | 72 72 6f 72 3d 2d 4c 6f |i];....e|rror=-Lo|
|000017d0| 67 4c 69 6b 65 6c 69 68 | 6f 6f 64 28 6d 79 44 61 |gLikelih|ood(myDa|
|000017e0| 74 61 50 74 72 2c 26 6d | 79 50 61 72 61 6d 73 2c |taPtr,&m|yParams,|
|000017f0| 4d 79 50 73 79 63 68 46 | 75 6e 29 3b 0d 09 0d 09 |MyPsychF|un);....|
|00001800| 2f 2a 20 44 69 61 67 6e | 6f 73 74 69 63 20 70 72 |/* Diagn|ostic pr|
|00001810| 69 6e 74 6f 75 74 20 66 | 6f 72 20 64 69 66 66 69 |intout f|or diffi|
|00001820| 63 75 6c 74 20 63 61 73 | 65 73 20 2a 2f 0d 09 69 |cult cas|es */..i|
|00001830| 66 28 69 74 65 72 3e 30 | 20 26 26 20 69 74 65 72 |f(iter>0| && iter|
|00001840| 25 35 30 20 3d 3d 20 30 | 20 26 26 20 69 74 65 72 |%50 == 0| && iter|
|00001850| 21 3d 6c 61 73 74 49 74 | 65 72 29 7b 0d 09 09 70 |!=lastIt|er){...p|
|00001860| 72 69 6e 74 66 28 22 45 | 72 72 6f 72 28 29 3a 20 |rintf("E|rror(): |
|00001870| 57 61 72 6e 69 6e 67 2c | 20 25 64 20 69 74 65 72 |Warning,| %d iter|
|00001880| 61 74 69 6f 6e 73 3a 5c | 6e 22 2c 28 69 6e 74 29 |ations:\|n",(int)|
|00001890| 69 74 65 72 29 3b 0d 09 | 09 70 72 69 6e 74 66 28 |iter);..|.printf(|
|000018a0| 22 6c 6f 67 41 6c 70 68 | 61 20 25 35 2e 32 66 2c |"logAlph|a %5.2f,|
|000018b0| 20 62 65 74 61 20 25 35 | 2e 31 66 2c 20 67 61 6d | beta %5|.1f, gam|
|000018c0| 6d 61 20 25 35 2e 32 66 | 2c 20 64 65 6c 74 61 20 |ma %5.2f|, delta |
|000018d0| 25 36 2e 33 66 20 2d 6c | 6f 67 20 6c 69 6b 65 6c |%6.3f -l|og likel|
|000018e0| 69 68 6f 6f 64 20 25 39 | 2e 30 67 5c 6e 22 0d 09 |ihood %9|.0g\n"..|
|000018f0| 09 09 2c 6d 79 50 61 72 | 61 6d 73 2e 6c 6f 67 41 |..,myPar|ams.logA|
|00001900| 6c 70 68 61 2c 6d 79 50 | 61 72 61 6d 73 2e 62 65 |lpha,myP|arams.be|
|00001910| 74 61 2c 6d 79 50 61 72 | 61 6d 73 2e 67 61 6d 6d |ta,myPar|ams.gamm|
|00001920| 61 2c 6d 79 50 61 72 61 | 6d 73 2e 64 65 6c 74 61 |a,myPara|ms.delta|
|00001930| 2c 65 72 72 6f 72 29 3b | 0d 09 09 6c 61 73 74 49 |,error);|...lastI|
|00001940| 74 65 72 3d 69 74 65 72 | 3b 0d 09 7d 0d 09 72 65 |ter=iter|;..}..re|
|00001950| 74 75 72 6e 20 65 72 72 | 6f 72 3b 0d 7d 0d 0d 00 |turn err|or;.}...|
|00001960| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001970| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001980| 00 00 01 00 00 00 01 80 | 00 00 00 80 00 00 00 52 |........|.......R|
|00001990| 0d 09 63 68 69 53 71 75 | 61 72 65 44 46 3d 6d 6f |..chiSqu|areDF=mo|
|000019a0| 6e 6f 74 6f 6e 69 63 44 | 46 2d 64 65 67 72 65 65 |notonicD|F-degree|
|000019b0| 11 50 73 79 63 68 6f 6d | 65 74 72 69 63 46 69 74 |.Psychom|etricFit|
|000019c0| 2e 63 02 00 00 00 54 45 | 58 54 43 57 49 45 01 00 |.c....TE|XTCWIE..|
|000019d0| 00 00 54 45 58 54 43 57 | 49 45 01 00 00 50 00 00 |..TEXTCW|IE...P..|
|000019e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000019f0| 00 00 a2 41 4a e1 00 00 | 18 df 00 00 01 d2 68 69 |...AJ...|......hi|
|00001a00| 53 71 75 61 72 65 44 46 | 29 3b 09 09 09 09 2f 2a |SquareDF|);..../*|
|00001a10| 20 73 69 67 6e 69 66 69 | 63 61 6e 63 65 20 2a 2f | signifi|cance */|
|00001a20| 0d 09 72 65 74 75 72 6e | 20 50 3b 0d 7d 0d 0d 2f |..return| P;.}../|
|00001a30| 2a 20 54 68 65 72 65 20 | 69 73 20 61 20 73 75 62 |* There |is a sub|
|00001a40| 74 6c 65 74 79 20 68 65 | 72 65 2e 20 49 20 74 68 |tlety he|re. I th|
|00001a50| 6f 75 67 68 74 20 74 68 | 61 74 20 49 20 63 6f 75 |ought th|at I cou|
|00001a60| 6c 64 20 75 73 65 20 50 | 6f 77 65 6c 6c 20 77 69 |ld use P|owell wi|
|00001a70| 74 68 20 74 68 65 20 77 | 68 6f 6c 65 20 70 61 72 |th the w|hole par|
|00001a80| 00 00 00 04 00 01 00 01 | 00 00 00 28 00 02 00 00 |........|...(....|
|00001a90| 16 bf 00 00 16 c4 05 45 | 72 72 6f 72 00 00 0c cc |.......E|rror....|
|00001aa0| 00 00 0c db 0f 50 73 79 | 63 68 6f 6d 65 74 72 69 |.....Psy|chometri|
|00001ab0| 63 46 69 74 00 00 00 48 | 00 09 4d 6f 6e 61 63 6f |cFit...H|..Monaco|
|00001ac0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001ad0| 00 00 00 00 00 00 00 00 | 00 00 00 06 00 04 00 2a |........|.......*|
|00001ae0| 00 03 01 dd 02 7d 00 26 | 00 04 01 dc 02 7c ac 56 |.....}.&|.....|.V|
|00001af0| 56 d6 00 00 09 dc 00 00 | 09 dc 00 00 00 00 00 00 |V.......|........|
|00001b00| 00 00 01 00 00 00 01 80 | 00 00 00 80 00 00 00 52 |........|.......R|
|00001b10| 00 3d dd 1c 2c 70 00 00 | 00 1c 00 52 00 01 4d 50 |.=..,p..|...R..MP|
|00001b20| 53 52 00 01 00 12 4d 57 | 42 42 00 00 00 2a 03 ef |SR....MW|BB...*..|
|00001b30| ff ff 00 00 00 08 00 00 | 00 00 03 ed ff ff 00 00 |........|........|
|00001b40| 00 34 00 3d 08 5c 03 f0 | ff ff 00 00 00 00 00 00 |.4.=.\..|........|
|00001b50| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001b60| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001b70| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
+--------+-------------------------+-------------------------+--------+--------+